function findAll(target) {
    let result = [];
    let temp = "";
    let left = 0;
    let right = 0;
    function dfs(temp, left, right) {
        if ((left + right) == target * 2) {
            result.push(temp)
        }
        if (left < target) {
            dfs(temp + "(", left + 1, right)
        }
        if (left > right) {
            dfs(temp + ")", left, right + 1)
        }
    }
    dfs(temp, left, right)
    return result
}

console.log(findAll(2))